<?php
$skill = elgg_extract ( 'entity', $vars, FALSE );
$base_url = elgg_get_site_url () . "resumes";
if (isset ( $skill->rate )) {
	$rate = elgg_view ( 'output/star', array (
			'name' => "rate",
			'checked' => intval($skill->rate),
			'entity_guid' => $skill->guid 
	) );
}



if ($skill->projectnum) {
	
	$projects = elgg_get_entities_from_relationship ( array (
			'relationship' => "skillobtained",
			'relationship_guid' => $skill->guid,
			'type' => "object",
			'subtype' => "project",
			'limit' => 10 
	) );
	$projectlistview = "";
	$project_num = 0;
	foreach ($projects as $project){
		$project_num++;
		$projectlistview .= "<strong>$project_num.$project->title<strong><br>";
	}
	if($project_num > 0){
		$str_projectnum = "&nbsp" . $project_num . " đồ án";
	}
	
}

if ($skill->canEdit ( elgg_get_logged_in_user_guid () )) {
	$del_url = "$base_url/delskill/{$skill->getGUID()}";
	$del_url = elgg_add_action_tokens_to_url ( $del_url );
	$del_confirm = elgg_echo ( 'submana:delete' );
	
	$edit_url = "$base_url/editskill/{$skill->getGUID()}";
	$edit_url = elgg_add_action_tokens_to_url ( $edit_url );
	$edit_label = elgg_echo ( 'submana:edit' );
	
	$edit_del_url = "<div class='right'>
	<ul class='elgg-menu elgg-menu-entity elgg-menu-hz elgg-menu-entity-default'>
	<li class='elgg-menu-item-edit'><a href='$edit_url'>$edit_label</a></li>
	<li class='elgg-menu-item-delete'><a href='$del_url'
	rel='$del_confirm'
	class='elgg-requires-confirmation'><span
	class='elgg-icon elgg-icon-delete '></span></a></li>
	</ul>
	</div>";
}

echo <<<___HTML
	$edit_del_url
	<div>
		$skill->title $rate 
		<a href="#" class="tooltip-moredetail">
			$str_projectnum
			<span>
					$projectlistview
			</span>
			
		</a>
	</div>
	<div style="margin-left:20px;">
		$skill->description
	</div>
___HTML;

?>